﻿using ReflectionStudio.Core.Events;
using System;
using System.ComponentModel;
using System.Data;
using System.Windows;
using WPFExcelReport.Helpers;
namespace WPFExcelReport
{
    public partial class TWFNEW
    {

        public TWFNEW()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return; 
            InitializeComponent();
        }
        public override void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            if (IsLoaded) return;
             
            if (!IsMasterFromMV)
            {
                MV = new VICC_WFEVENTS();
                this.DataContext = MV;
            }
            base.Window_Loaded(sender, e);
        }
        public override void SaveCommand(object sender, RoutedEventArgs e)
        {
            try
            {
                dwData = VICC_WFEVENTS.SVWF.TBMain.NewRow();
                dwData["ROWNID"] = ((MetroViewModel)DataContext).NWFID;
                dwData["WHAT"] = DES;
                VICC_WFEVENTS.SVWF.UWF02(dwData);
                IsNewWF = false;
                base.SaveCommand(sender, e);
            }
            catch(Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);

            } 
        }
    }
}
